package com.me.adapter;

import java.util.ArrayList;

import com.me.data.DBItem;
import com.me.fragment.DBPageFragment;
import com.me.util.AppConstant;
import com.me.util.AppUtil;

import android.support.v4.app.Fragment;
import android.support.v4.app.FragmentManager;
import android.support.v4.app.FragmentStatePagerAdapter;

public class DBPagerAdapter extends FragmentStatePagerAdapter {
	
	public DBPagerAdapter(FragmentManager fragmentManager) {
		super(fragmentManager);

	}

	@Override
	public Fragment getItem(int position) {
		
		ArrayList<DBItem> itemList = null;
		if (AppUtil.Event.eventType == AppConstant.EVENT_INDEX_TITLE) {

			itemList = AppUtil.App.dataService.retrieveTitles();
						
		} else {

			itemList = AppUtil.App.dataService.retrieveLoactions();
			
		}
		DBPageFragment fragment = DBPageFragment.newInstance(
				itemList, position);
		return fragment;
	}

	@Override
	public int getCount() {
		return 1;
	}

	@Override
	public CharSequence getPageTitle(int position) {
		return "All";
	}

}
